<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// 
//  category_model.php
//  www.6block.com
//  
//  Created by Will_Lee on 2011-06-14.
//  Copyright 2011 lishuzu. All rights reserved.
// 


class Category_model extends CI_model{
	function __construct(){
		parent::__construct();
		$this->userinfo = $this->session->userdata('userinfo');
	}
	
	function get_categories(){
		$categories = array();
		$this->db->order_by('displayorder', "ASC");
		$query = $this->db->get('category');
		foreach ($query->result_array() as $row) {
			$categories[] = $row;
		}
		return $categories;
	}
	// 增加分类
	function add_category($category){
		if ($category) {
			$this->db->insert('category', $category);
			return $this->db->insert_id();
		}else{
			return false;
		}
	}
}
/* End of file category_model.php */
/* Location: ./application/models/category.php */
?>